//
//  PatrolServiceClient.h
//  Patrol
//
//  Created by 范武 on 13-2-22.
//  Copyright (c) 2013年 FSTI. All rights reserved.
//

#import "AFHTTPClient.h"
#import <CoreLocation/CoreLocation.h>

#define kServerAddress @"http://222.76.124.9"
#define kLoginPath @"/intf-gis/login.jsp"
#define kSearchTermPath @"/intf-gis/worklist/query.jsp"
#define kSearchAllPath @"/intf-gis/worklist/all.jsp"
#define kSearchPlainPath @"/intf-gis/worklist/content.jsp"
#define kWorkDetailPath @"/intf-gis/workitem/itemdetail.jsp"
#define kSearchWithGps @"/intf-gis/worklist/querygps.jsp"

typedef void(^outJsonBlock)(id outJson, NSError *error);
@interface PatrolServiceClient : AFHTTPClient
+ (PatrolServiceClient *)shareInstance;

- (void) loginWithUsername:(NSString *)username password:(NSString *)password resultBlock:(outJsonBlock)block;
- (void) searchWithTerm:(NSString *)username searchTerm:(NSString *)searchTerm resultBlock:(outJsonBlock)block;
- (void)searchAll:(NSString *)username pageSize:(NSInteger)pageSize pageNumber:(NSInteger)pageNumber resultBlock:(outJsonBlock)block;
- (void)searchPlain:(NSString *)username workID:(NSString *)workID resultBlock:(outJsonBlock)block;

- (void)getUser:(NSString *) username Work:(NSString *)workId resultBlock:(outJsonBlock)block;

- (void)searchWithGps:(NSString *)username latitude:(double)latitude longitude:(double)longitude resultBlock:(outJsonBlock)block;

- (void)submitWork:(NSString *)workID task:(NSInteger)taskID location:(CLLocationCoordinate2D)geoLocation formValues:(NSArray *)info resultBlock:(outJsonBlock)block;

- (void)cancelHttpRequest:(NSString *)path;

- (void)uploadPic:(UIImage *)img name:(NSString *)picName taskID:(NSInteger)taskID;
@end
